﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dhtl.Service.IService;
using DataBase.Daihoctuonglai;
using Dhtl_Repositry.Repository;

namespace Dhtl.Service.Service
{
    public class Service_UserInRoles : IUserInRoles
    {
        public List<UserInRole> List()
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                return sv.List();
            }
        }

        public UserInRole GetById(int id)
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                return sv.GetById(id);
            }
        }

        public void AddOrUpdate(UserInRole entity)
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                sv.CreateOrUpdate(entity);
            }
        }

        public void delete(int id)
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                sv.Delete(id);
            }
        }

        public bool checkExitsRolesiD(int userId, int RoledID)
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                return sv.checkExitsRolesiD(userId, RoledID);
            }
        }

        public void removeRolesInUsser(int userId, int RoledID)
        {
            using (UserInRolesRepositry sv = new UserInRolesRepositry())
            {
                sv.removeRolesInUsser(userId, RoledID);
            }
        }

    }
}
